<?php
/**
 * Author: Administrator
 * Date: 2022/7/21 2:12
 */

namespace DesignPatterns\Structural\Decorator;


class XmlRenderer extends RenderDecorator
{

    public function renderData()
    {
        $data = $this->service->renderData();
        $xml = new \DOMDocument();
        foreach ($data as $k=>$v) {
            $xml->appendChild($xml->createElement($k, $v));
        }
        return $xml->saveXML();
    }
}